#ifndef __AI_CONFIG_H__
#define __AI_CONFIG_H__
#include "ai_test.h"

void config_ai_mode_sample(void *param) {
    struct ai_param_t *pparam = (struct ai_param_t *)param;
    uint8_t i = 0;

    for (i = 0; i < pparam->dev_num; i++) {
        pparam->dev[i].index = i;
    }
    if (pparam->read_cnt == 0)
        pparam->read_cnt = 1;
    pparam->en_read = 1;
    pparam->read_cnt = 1;

    pparam->mode = AI_MOD_SMP;
    if (pparam->osr == 0) {
        pparam->osr = AI_OSR_0;
    }
    if (pparam->sample == 0) {
        pparam->sample = 100000;    /* 100KHz */
    }
    if (pparam->samp_tim == 0) {
        pparam->samp_tim = 250;     /* 4KHz */
    }
    if (pparam->slid_win == 0) {
        pparam->slid_win = 1;
    }
};

void config_ai_mode_sample_time_irq(void *param) {
    struct ai_param_t *pparam = (struct ai_param_t *)param;
    uint8_t i = 0;

    for (i = 0; i < pparam->dev_num; i++) {
        pparam->dev[i].index = i;
    }

    if (pparam->read_cnt == 0)
        pparam->read_cnt = 1;

    pparam->en_read = 1;
    pparam->read_cnt = -1;

    pparam->mode = AI_MOD_SMP_TIM;
    if (pparam->osr == 0) {
        pparam->osr = AI_OSR_0;
    }
    if (pparam->sample == 0) {
        pparam->sample = 100000;    /* 100KHz */
    }
    if (pparam->samp_tim == 0) {
        pparam->samp_tim = 250;     /* 4KHz */
    }
    if (pparam->slid_win == 0) {
        pparam->slid_win = 1;
    }
};

void config_ai_mode_raw_dma_irq(void *param) {
    struct ai_param_t *pparam = (struct ai_param_t *)param;
    uint8_t i = 0;

    for (i = 0; i < pparam->dev_num; i++) {
        pparam->dev[i].index = i;
    }

    if (pparam->read_cnt == 0)
        pparam->read_cnt = 1;

    pparam->en_read = 1;
    pparam->read_cnt = -1;

    pparam->mode = AI_MOD_RAW_DMA;
    if (pparam->osr == 0) {
        pparam->osr = AI_OSR_0;
    }
    if (pparam->sample == 0) {
        pparam->sample = 100000;    /* 100KHz */
    }
    if (pparam->samp_tim == 0) {
        pparam->samp_tim = 250;     /* 4KHz */
    }
    if (pparam->slid_win == 0) {
        pparam->slid_win = 1;
    }
};

void config_ai_mode_raw(void *param) {
    struct ai_param_t *pparam = (struct ai_param_t *)param;
    uint8_t i = 0;

    for (i = 0; i < pparam->dev_num; i++) {
        pparam->dev[i].index = i;
    }

    if (pparam->read_cnt == 0)
        pparam->read_cnt = 1;

    pparam->en_read = 1;
    pparam->read_cnt = 1;

    pparam->mode = AI_MOD_RAW;
    if (pparam->osr == 0) {
        pparam->osr = AI_OSR_0;
    }
    if (pparam->sample == 0) {
        pparam->sample = 100000;    /* 100KHz */
    }
    if (pparam->samp_tim == 0) {
        pparam->samp_tim = 250;     /* 4KHz */
    }
    if (pparam->slid_win == 0) {
        pparam->slid_win = 1;
    }
};

#endif /* __AI_CONFIG_H__ */
